package com.c.ctgproject.fragment.review.car

import androidx.lifecycle.LiveData
import androidx.lifecycle.MutableLiveData
import com.c.ctgproject.base.BaseViewModel
import com.c.ctgproject.http.ApiMethods
import com.c.ctgproject.mode.MyConstants
import com.c.ctgproject.utils.awaitSync
import com.c.ctgproject.utils.handlerBody
import com.c.ctgproject.utils.launch
import com.c.ctgproject.utils.userToken

class AgreeCarViewModel : BaseViewModel() {

    private val mResult = MutableLiveData<String>()
    val result: LiveData<String> get() = mResult
    fun getList(page: Int, size: Int) {
        launch({
            mResult.value = ApiMethods.retrofit.reviewCarsList(
                userToken, handlerBody(
                    "isPass" to MyConstants.AGREE,
                    "pageNum" to page,
                    "pageSize" to size
                )
            ).awaitSync()
        }, {
            mError.value = it.message.toString()
        })
    }
}